package com.polytech.dao;

import java.util.Collection;
import java.util.HashMap;

import com.polytech.beans.Category;

public class MemoryCategoryDao implements CategoryDao {

	private HashMap<String, Category> categories=new HashMap<String, Category>();;
	
	public MemoryCategoryDao() {
		insert(new Category("economic", 1));
		insert(new Category("lowCost", 2));
		insert(new Category("highClass", 3));
	}
	@Override
	public void insert(Category category) {
		categories.put(category.getLabel(), category);
	}
	@Override
	public Category select(String key) {
		return categories.get(key);
	}
	@Override
	public void remove(Category category) {
		categories.remove(category.getLabel());
	}
	@Override
	public Collection<Category> selectAll() {
		return categories.values();
	}
}
